<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:core="http://www.contact.core.com/contacts/core/ui"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:common="http://www.contact.common.com/contacts/ui"
        >

<!--@elvariable id="id" type="java.lang.String"-->
<ui:component>
    <h:panelGrid style="background:inherit" columns="2">
        <h:panelGroup layout="block">
            <h:outputLabel value="#{resources.accountEmailLabel}:"/>
        </h:panelGroup>
        <h:outputLabel value="#{contactInformationSessionBean.email}"/>
    </h:panelGrid>

    <h:panelGrid columns="1">
        <h:panelGroup style="float:left;" layout="block">
            <h:panelGroup style="float:left">
                <h:outputLabel value="#{resources.anotherEmailLabel}:"/>
            </h:panelGroup>
            <h:panelGroup style="margin-left:5px">
                <a4j:commandButton image="./style/images/add.PNG"
                                   action="#{contactInformation.addNewEmailRow}"
                                   reRender="#{id}richTableForContact">
                    <rich:toolTip value="#{resources.addLabel}" direction="bottom-right"/>
                </a4j:commandButton>
                <!--<a4j:commandLink value="Add"-->
                <!--action="#{contactInformation.addNewEmailRow}"-->
                <!--reRender="#{id}richTableForContact">-->
                <!--</a4j:commandLink>-->
            </h:panelGroup>
        </h:panelGroup>
        <h:panelGroup id="#{id}richTableForContact"
                      rendered="#{not empty contactInformationSessionBean.allEmails}"
                      layout="block"
                      style="float:left;">
            <rich:dataTable style="background:inherit" cellpadding="0"
                            value="#{contactInformationSessionBean.allEmails}" var="data">


                <rich:column>
                    <!--<f:facet name="header">-->
                    <!--<h:outputLabel value="Email"/>-->
                    <!--</f:facet>-->

                    <h:panelGrid columns="4">
                        <h:panelGroup layout="block" style="width:50px">
                            <h:outputLabel value="#{resources.emailLabel}"/>
                        </h:panelGroup>
                        <h:panelGroup layout="block" style="width:150px; ">
                            <h:inputText value="#{data.mail.mail}"/>
                        </h:panelGroup>


                        <rich:comboBox value="#{data.mail.contactKind}"
                                       enableManualInput="false"
                                       selectFirstOnUpdate="false"
                                       defaultLabel="#{data.mail.contactKind}"
                                       width="60px">
                            <f:selectItems value="#{contactInformation.emailKinds}"/>
                        </rich:comboBox>

                        <a4j:commandButton rendered="#{data.existsRemoveLink}"
                                           image="./style/images/remove.PNG"
                                           action="#{contactInformation.removeEmailRow}"
                                           reRender="#{id}richTableForContact">
                            <rich:toolTip value="#{resources.removeLabel}" direction="bottom-right"/>
                            <f:param value="#{data.index}" name="mailIndex"/>
                        </a4j:commandButton>
                        <!--<a4j:commandLink rendered="#{data.existsRemoveLink}"-->
                        <!--value="Remove"-->
                        <!--action="#{contactInformation.removeEmailRow}"-->
                        <!--reRender="#{id}richTableForContact">-->
                        <!--<f:param value="#{data.index}" name="mailIndex"/>-->
                        <!--</a4j:commandLink>-->
                    </h:panelGrid>


                </rich:column>
                <!--<rich:column>-->
                <!--<f:facet name="header">-->
                <!--<h:outputLabel value="Kind"/>-->
                <!--</f:facet>-->
                <!---->
                <!--</rich:column>-->

                <!--<rich:column>-->
                <!--<f:facet name="header">-->
                <!--<h:outputLabel value="Operation"/>-->
                <!--</f:facet>-->
                <!---->
                <!--</rich:column>-->

            </rich:dataTable>
        </h:panelGroup>
    </h:panelGrid>
</ui:component>


</html>
